package com.moli.iov.open.service.impl;

import com.moli.iov.base.model.dto.req.QueryVehicleFenceOpDto;
import com.moli.iov.base.model.dto.req.VehicleFenceReqDto;
import com.moli.iov.base.model.dto.req.VehicleFenceReqOpDto;
import com.moli.iov.base.model.dto.res.VehicleFenceResDto;
import com.moli.iov.base.remote.IVehicleFenceRemoteService;
import com.moli.iov.model.dto.req.PageExtend;
import com.moli.iov.open.service.VehicleFenceService;
import com.moli.iov.rest.RestResponse;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author whl
 */
@Service
public class VehicleFenceServiceImpl implements VehicleFenceService {

  @Reference(group = "${service.group}", check = false)
  private IVehicleFenceRemoteService iVehicleFenceRemoteService;


  @Override
  public RestResponse saveVehicleFence(VehicleFenceReqOpDto dto) {
    return iVehicleFenceRemoteService.saveVehicleFenceOp(dto);
  }

  @Override
  public RestResponse updateVehicleFence(VehicleFenceReqOpDto dto) {
    return iVehicleFenceRemoteService.updateVehicleFenceOp(dto);
  }

  @Override
  public RestResponse deleteVehicleFence(VehicleFenceReqOpDto dto) {
    return iVehicleFenceRemoteService.deleteVehicleFenceOp(dto);
  }

  @Override
  public RestResponse<PageExtend<VehicleFenceResDto>>  listVehicleFence(VehicleFenceReqDto dto) {
    return iVehicleFenceRemoteService.listVehicleFence(dto);
  }

  @Override
  public RestResponse redrawVehicleFence(VehicleFenceReqDto dto) {
    return iVehicleFenceRemoteService.redrawVehicleFence(dto);
  }

  /**
   * 根据围栏id得到围栏
   *
   * @param dto fenceIdList  null 为全部
   * @return
   */
  @Override
  public RestResponse listVehicleFences(QueryVehicleFenceOpDto dto) {
    return iVehicleFenceRemoteService.listVehicleFenceOp(dto);
  }

  /**
   * 围栏是否绑定有车
   * @param dto fenceId
   * @return
   */
  @Override
  public RestResponse isBindingVehicleByFenceId(QueryVehicleFenceOpDto dto) {
    return iVehicleFenceRemoteService.isBindingVehicleByFenceId(dto);
  }

  /**
   * 根据围栏名称模糊查找围栏
   * @param dto
   * @return
   */
  @Override
  public RestResponse listVehicleFenceByFenceName(QueryVehicleFenceOpDto dto) {
    return iVehicleFenceRemoteService.listVehicleFenceByFenceNameOp(dto);
  }

  /**
   * 根据车架号返回围栏信息
   * @param dto
   * @return
   */
  @Override
  public RestResponse listVehicleFenceByVinList(QueryVehicleFenceOpDto dto) {
    return iVehicleFenceRemoteService.listVehicleFenceByVinList(dto);
  }

  @Override
  public RestResponse getVehicleFenceById(QueryVehicleFenceOpDto dto) {

    return iVehicleFenceRemoteService.getVehicleFenceOpById(dto.getFenceId());
  }
}
